package com.polonium.eclipserunner.webdriver.example.pages;

import com.polonium.eclipserunner.webdriver.PoloniumPage;
import com.polonium.eclipserunner.webdriver.annotations.PageURL;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

@PageURL("http://www.onet.pl")
public class OnetMainPage extends PoloniumPage{
	private static final String DEFAULT_SEARCH_PHASE = "test";
		
	@FindBy(id = "searchQuery")
	WebElement searchField;
	
	@FindBy(id = "searchSubmit")
	WebElement searchButton;
	
	public OnetMainPage fillSearchField(String phase){
		searchField.sendKeys(phase);
		return this;
	}
	
	public OnetMainPage fillSearchField(){
		return fillSearchField(DEFAULT_SEARCH_PHASE);
	}
	
	public SearchResultsPage clickSearchButton(){
		searchButton.submit();
		return new SearchResultsPage();
	}
}
